package codename.carrot.bomberman.game.gamemessages;

/**
 * A network message representing a player losing a life
 * @author Group A4
 *
 */
 public class PlayerLostLifeMessage extends BombermanMessage {	 
	 /**
	  *  the UID for serialization
	  */
    private static final long serialVersionUID = 1L;
    /**
     * the ID of the player that took the life
     */
    private int killedByPlayer;
    /**
     * number of lives left for player that lost a life
     */
    private int nrLivesLeft;
    
    /**
     * Constructor
     * @param playerKilledId the ID of the player that lost a life
     * @param killedByPlayer the ID of the player that took a life
     * @param nrLivesLeft nr of lives left for the player that lost a life
     */
    public PlayerLostLifeMessage(int playerKilledId, int killedByPlayer, int nrLivesLeft) {
        super(playerKilledId);
        this.killedByPlayer = killedByPlayer;
        this.nrLivesLeft = nrLivesLeft;
    }        
    
    /**
     * Returns the ID of the player that took the life
     * @return player ID
     */
    public int getKilledByPlayerId() {
        return killedByPlayer;
    }
    
    /** 
     *  Returns true if nrOfLivesLeft is 0
     * @return true|false
     */
    public boolean hasDied() {
        return nrLivesLeft <= 0;
    }
    
    /**
     * Returns the number of lives left
     * @return lives left
     */
    public int getNrLivesLeft() {
        return nrLivesLeft;
    }
}
